package org.momo.rpc.config;

import lombok.extern.slf4j.Slf4j;
import org.yaml.snakeyaml.Yaml;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Map;

/**
 *
 */
@Slf4j
public class YamlLoader {
    public static Map<String, Object> loadConfig(String filePath) {
        Yaml yaml = new Yaml();
        try {
            FileInputStream inputStream = new FileInputStream(filePath);
            return yaml.load(inputStream);
        } catch (FileNotFoundException e) {
            log.error("load config file error! the error is: {}", e.getMessage());
        }
        return null;
    }
}
